//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_blselchanged.sqf"
#include "x_setup.sqf"

#include "x_uiinc.sqf"

private ["_selection", "_control", "_selectedIndex", "_bar", "_class", "_pic"];
disableSerialization;
PARAMS_1(_selection);

_control = _selection select 0;
_selectedIndex = _selection select 1;

if (_selectedIndex == -1) exitWith {};

_bar = switch (GVAR(side_player)) do {
	case blufor: {GVAR(backpackclasses) select 0};
	case opfor: {GVAR(backpackclasses) select 1};
};

_control = __uiGetVar(GVAR(BACKPACK_DIALOG)) displayCtrl 1001;

_class = _bar select _selectedIndex;
_pic = getText (configFile/"cfgVehicles"/_class/"picture");

_control ctrlSetText _pic;

_control = __uiGetVar(GVAR(BACKPACK_DIALOG)) displayCtrl 1003;
_control ctrlSetText format [(localize "STR_DOM_MISSIONSTRING_687"), getText (configFile/"cfgVehicles"/_class/"displayName")];